﻿using System;
using UnityEngine;

namespace UnityStandardAssets.CinematicEffects
{
	// Token: 0x0200059B RID: 1435
	[AddComponentMenu("Image Effects/Other/DepthOfField")]
	[RequireComponent(typeof(Camera))]
	[ExecuteInEditMode]
	public class DepthOfField : MonoBehaviour
	{
		// Token: 0x1700020A RID: 522
		// (get) Token: 0x06001CE5 RID: 7397 RVA: 0x0001224D File Offset: 0x0001044D
		public Material filmicDepthOfFieldMaterial
		{
			get
			{
				if (this.m_FilmicDepthOfFieldMaterial == null)
				{
					this.m_FilmicDepthOfFieldMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.filmicDepthOfFieldShader);
				}
				return this.m_FilmicDepthOfFieldMaterial;
			}
		}

		// Token: 0x1700020B RID: 523
		// (get) Token: 0x06001CE6 RID: 7398 RVA: 0x00012277 File Offset: 0x00010477
		public Material medianFilterMaterial
		{
			get
			{
				if (this.m_MedianFilterMaterial == null)
				{
					this.m_MedianFilterMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.medianFilterShader);
				}
				return this.m_MedianFilterMaterial;
			}
		}

		// Token: 0x1700020C RID: 524
		// (get) Token: 0x06001CE7 RID: 7399 RVA: 0x000122A1 File Offset: 0x000104A1
		public Material textureBokehMaterial
		{
			get
			{
				if (this.m_TextureBokehMaterial == null)
				{
					this.m_TextureBokehMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.textureBokehShader);
				}
				return this.m_TextureBokehMaterial;
			}
		}

		// Token: 0x1700020D RID: 525
		// (get) Token: 0x06001CE8 RID: 7400 RVA: 0x00061DB0 File Offset: 0x0005FFB0
		public ComputeBuffer computeBufferDrawArgs
		{
			get
			{
				if (this.m_ComputeBufferDrawArgs == null)
				{
					this.m_ComputeBufferDrawArgs = new ComputeBuffer(1, 16, ComputeBufferType.DrawIndirect);
					int[] data = new int[]
					{
						0,
						1,
						0,
						0
					};
					this.m_ComputeBufferDrawArgs.SetData(data);
				}
				return this.m_ComputeBufferDrawArgs;
			}
		}

		// Token: 0x1700020E RID: 526
		// (get) Token: 0x06001CE9 RID: 7401 RVA: 0x000122CB File Offset: 0x000104CB
		public ComputeBuffer computeBufferPoints
		{
			get
			{
				if (this.m_ComputeBufferPoints == null)
				{
					this.m_ComputeBufferPoints = new ComputeBuffer(90000, 28, ComputeBufferType.Append);
				}
				return this.m_ComputeBufferPoints;
			}
		}

		// Token: 0x06001CEA RID: 7402 RVA: 0x00061E04 File Offset: 0x00060004
		public void OnEnable()
		{
			if (this.filmicDepthOfFieldShader == null)
			{
				this.filmicDepthOfFieldShader = Shader.Find("Hidden/DepthOfField/DepthOfField");
			}
			if (this.medianFilterShader == null)
			{
				this.medianFilterShader = Shader.Find("Hidden/DepthOfField/MedianFilter");
			}
			if (this.textureBokehShader == null)
			{
				this.textureBokehShader = Shader.Find("Hidden/DepthOfField/BokehSplatting");
			}
			if (!ImageEffectHelper.IsSupported(this.filmicDepthOfFieldShader, true, true, this) || !ImageEffectHelper.IsSupported(this.medianFilterShader, true, true, this))
			{
				base.enabled = false;
				Debug.LogWarning("The image effect " + this.ToString() + " has been disabled as it's not supported on the current platform.");
				return;
			}
			if (ImageEffectHelper.supportsDX11 && !ImageEffectHelper.IsSupported(this.textureBokehShader, true, true, this))
			{
				base.enabled = false;
				Debug.LogWarning("The image effect " + this.ToString() + " has been disabled as it's not supported on the current platform.");
				return;
			}
			this.ComputeBlurDirections(true);
			base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
		}

		// Token: 0x06001CEB RID: 7403 RVA: 0x00061F18 File Offset: 0x00060118
		public void OnDisable()
		{
			this.ReleaseComputeResources();
			if (this.m_FilmicDepthOfFieldMaterial)
			{
				UnityEngine.Object.DestroyImmediate(this.m_FilmicDepthOfFieldMaterial);
			}
			if (this.m_TextureBokehMaterial)
			{
				UnityEngine.Object.DestroyImmediate(this.m_TextureBokehMaterial);
			}
			if (this.m_MedianFilterMaterial)
			{
				UnityEngine.Object.DestroyImmediate(this.m_MedianFilterMaterial);
			}
			this.m_TextureBokehMaterial = null;
			this.m_FilmicDepthOfFieldMaterial = null;
			this.m_MedianFilterMaterial = null;
			this.m_RTU.ReleaseAllTemporyRenderTexutres();
		}

		// Token: 0x06001CEC RID: 7404 RVA: 0x00061F9C File Offset: 0x0006019C
		public void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			if (this.medianFilterMaterial == null || this.filmicDepthOfFieldMaterial == null)
			{
				Graphics.Blit(source, destination);
				return;
			}
			if (this.visualizeBluriness)
			{
				Vector4 vector;
				Vector4 vector2;
				this.ComputeCocParameters(out vector, out vector2);
				this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector);
				this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector2);
				Graphics.Blit(null, destination, this.filmicDepthOfFieldMaterial, (this.uiMode != DepthOfField.UIMode.Explicit) ? 6 : 7);
			}
			else
			{
				this.DoDepthOfField(source, destination);
			}
			this.m_RTU.ReleaseAllTemporyRenderTexutres();
		}

		// Token: 0x06001CED RID: 7405 RVA: 0x00062044 File Offset: 0x00060244
		public void DoDepthOfField(RenderTexture source, RenderTexture destination)
		{
			float num = (float)source.height / 720f;
			float num2 = num;
			float num3 = Mathf.Max(this.nearRadius, this.farRadius) * num2 * 0.75f;
			float num4 = this.nearRadius * num;
			float num5 = this.farRadius * num;
			float num6 = Mathf.Max(num4, num5);
			DepthOfField.ApertureShape apertureShape = this.apertureShape;
			if (apertureShape != DepthOfField.ApertureShape.Hexagonal)
			{
				if (apertureShape == DepthOfField.ApertureShape.Octogonal)
				{
					num6 *= 1.15f;
				}
			}
			else
			{
				num6 *= 1.2f;
			}
			if (num6 < 0.5f)
			{
				Graphics.Blit(source, destination);
				return;
			}
			int width = source.width / 2;
			int height = source.height / 2;
			Vector4 vector = new Vector4(num4 * 0.5f, num5 * 0.5f, 0f, 0f);
			RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(width, height, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
			RenderTexture temporaryRenderTexture2 = this.m_RTU.GetTemporaryRenderTexture(width, height, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
			Vector4 vector2;
			Vector4 vector3;
			this.ComputeCocParameters(out vector2, out vector3);
			this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector2);
			this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector3);
			this.filmicDepthOfFieldMaterial.SetVector("_BoostParams", new Vector4(num4 * this.nearBoostAmount * -0.5f, num5 * this.farBoostAmount * 0.5f, this.boostPoint, 0f));
			Graphics.Blit(source, temporaryRenderTexture2, this.filmicDepthOfFieldMaterial, (this.uiMode != DepthOfField.UIMode.Explicit) ? 4 : 5);
			RenderTexture renderTexture = temporaryRenderTexture2;
			RenderTexture renderTexture2 = temporaryRenderTexture;
			if (this.shouldPerformBokeh)
			{
				RenderTexture temporaryRenderTexture3 = this.m_RTU.GetTemporaryRenderTexture(width, height, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
				Graphics.Blit(renderTexture, temporaryRenderTexture3, this.filmicDepthOfFieldMaterial, 1);
				this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
				Graphics.Blit(temporaryRenderTexture3, renderTexture2, this.filmicDepthOfFieldMaterial, 0);
				this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
				Graphics.Blit(renderTexture2, temporaryRenderTexture3, this.filmicDepthOfFieldMaterial, 0);
				this.textureBokehMaterial.SetTexture("_BlurredColor", temporaryRenderTexture3);
				this.textureBokehMaterial.SetFloat("_SpawnHeuristic", this.textureBokehSpawnHeuristic);
				this.textureBokehMaterial.SetVector("_BokehParams", new Vector4(this.textureBokehScale * num2, this.textureBokehIntensity, this.textureBokehThreshold, num3));
				Graphics.SetRandomWriteTarget(1, this.computeBufferPoints);
				Graphics.Blit(renderTexture, renderTexture2, this.textureBokehMaterial, 1);
				Graphics.ClearRandomWriteTargets();
				DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
				this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture3);
			}
			this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector2);
			this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector);
			this.filmicDepthOfFieldMaterial.SetVector("_BoostParams", new Vector4(num4 * this.nearBoostAmount * -0.5f, num5 * this.farBoostAmount * 0.5f, this.boostPoint, 0f));
			RenderTexture renderTexture3 = null;
			if (this.dilateNearBlur)
			{
				RenderTexture temporaryRenderTexture4 = this.m_RTU.GetTemporaryRenderTexture(width, height, 0, RenderTextureFormat.RGHalf, FilterMode.Bilinear);
				renderTexture3 = this.m_RTU.GetTemporaryRenderTexture(width, height, 0, RenderTextureFormat.RGHalf, FilterMode.Bilinear);
				this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(0f, num4 * 0.75f, 0f, 0f));
				Graphics.Blit(renderTexture, temporaryRenderTexture4, this.filmicDepthOfFieldMaterial, 2);
				this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(num4 * 0.75f, 0f, 0f, 0f));
				Graphics.Blit(temporaryRenderTexture4, renderTexture3, this.filmicDepthOfFieldMaterial, 3);
				this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture4);
			}
			if (this.prefilterBlur)
			{
				Graphics.Blit(renderTexture, renderTexture2, this.filmicDepthOfFieldMaterial, 8);
				DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
			}
			switch (this.apertureShape)
			{
			case DepthOfField.ApertureShape.Circular:
				this.DoCircularBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
				break;
			case DepthOfField.ApertureShape.Hexagonal:
				this.DoHexagonalBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
				break;
			case DepthOfField.ApertureShape.Octogonal:
				this.DoOctogonalBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
				break;
			}
			DepthOfField.FilterQuality filterQuality = this.medianFilter;
			if (filterQuality != DepthOfField.FilterQuality.Normal)
			{
				if (filterQuality == DepthOfField.FilterQuality.High)
				{
					Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 1);
					DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
				}
			}
			else
			{
				this.medianFilterMaterial.SetVector("_Offsets", new Vector4(1f, 0f, 0f, 0f));
				Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 0);
				DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
				this.medianFilterMaterial.SetVector("_Offsets", new Vector4(0f, 1f, 0f, 0f));
				Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 0);
				DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
			}
			this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector);
			this.filmicDepthOfFieldMaterial.SetVector("_Convolved_TexelSize", new Vector4((float)renderTexture.width, (float)renderTexture.height, 1f / (float)renderTexture.width, 1f / (float)renderTexture.height));
			this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", renderTexture);
			int pass = (this.uiMode != DepthOfField.UIMode.Explicit) ? 13 : 14;
			if (this.highQualityUpsampling)
			{
				pass = ((this.uiMode != DepthOfField.UIMode.Explicit) ? 15 : 16);
			}
			if (this.shouldPerformBokeh)
			{
				RenderTexture temporaryRenderTexture5 = this.m_RTU.GetTemporaryRenderTexture(source.height, source.width, 0, source.format, FilterMode.Bilinear);
				Graphics.Blit(source, temporaryRenderTexture5, this.filmicDepthOfFieldMaterial, pass);
				Graphics.SetRenderTarget(temporaryRenderTexture5);
				ComputeBuffer.CopyCount(this.computeBufferPoints, this.computeBufferDrawArgs, 0);
				this.textureBokehMaterial.SetBuffer("pointBuffer", this.computeBufferPoints);
				this.textureBokehMaterial.SetTexture("_MainTex", this.bokehTexture);
				this.textureBokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), num3));
				this.textureBokehMaterial.SetPass(0);
				Graphics.DrawProceduralIndirect(MeshTopology.Points, this.computeBufferDrawArgs, 0);
				Graphics.Blit(temporaryRenderTexture5, destination);
			}
			else
			{
				Graphics.Blit(source, destination, this.filmicDepthOfFieldMaterial, pass);
			}
		}

		// Token: 0x06001CEE RID: 7406 RVA: 0x000626F4 File Offset: 0x000608F4
		public void DoHexagonalBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
		{
			this.ComputeBlurDirections(false);
			int pass;
			int pass2;
			DepthOfField.GetDirectionalBlurPassesFromRadius(blurredFgCoc, maxRadius, out pass, out pass2);
			this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
			RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(src.width, src.height, 0, src.format, FilterMode.Bilinear);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection1);
			Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, pass);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection2);
			Graphics.Blit(temporaryRenderTexture, src, this.filmicDepthOfFieldMaterial, pass);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection3);
			this.filmicDepthOfFieldMaterial.SetTexture("_ThirdTex", src);
			Graphics.Blit(temporaryRenderTexture, dst, this.filmicDepthOfFieldMaterial, pass2);
			this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture);
			DepthOfField.SwapRenderTexture(ref src, ref dst);
		}

		// Token: 0x06001CEF RID: 7407 RVA: 0x000627DC File Offset: 0x000609DC
		public void DoOctogonalBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
		{
			this.ComputeBlurDirections(false);
			int pass;
			int pass2;
			DepthOfField.GetDirectionalBlurPassesFromRadius(blurredFgCoc, maxRadius, out pass, out pass2);
			this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
			RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(src.width, src.height, 0, src.format, FilterMode.Bilinear);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection1);
			Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, pass);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection2);
			Graphics.Blit(temporaryRenderTexture, dst, this.filmicDepthOfFieldMaterial, pass);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection3);
			Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, pass);
			this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection4);
			this.filmicDepthOfFieldMaterial.SetTexture("_ThirdTex", dst);
			Graphics.Blit(temporaryRenderTexture, src, this.filmicDepthOfFieldMaterial, pass2);
			this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture);
		}

		// Token: 0x06001CF0 RID: 7408 RVA: 0x000628E4 File Offset: 0x00060AE4
		public void DoCircularBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
		{
			int pass;
			if (blurredFgCoc != null)
			{
				this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
				pass = ((maxRadius <= 10f) ? 12 : 10);
			}
			else
			{
				pass = ((maxRadius <= 10f) ? 11 : 9);
			}
			Graphics.Blit(src, dst, this.filmicDepthOfFieldMaterial, pass);
			DepthOfField.SwapRenderTexture(ref src, ref dst);
		}

		// Token: 0x06001CF1 RID: 7409 RVA: 0x00062958 File Offset: 0x00060B58
		public void ComputeCocParameters(out Vector4 blurParams, out Vector4 blurCoe)
		{
			Camera component = base.GetComponent<Camera>();
			float num = (!this.focusTransform) ? (this.focusPlane * this.focusPlane * this.focusPlane * this.focusPlane) : (component.WorldToViewportPoint(this.focusTransform.position).z / component.farClipPlane);
			if (this.uiMode == DepthOfField.UIMode.Basic || this.uiMode == DepthOfField.UIMode.Advanced)
			{
				float w = this.focusRange * this.focusRange * this.focusRange * this.focusRange;
				float num2 = 4f / Mathf.Tan(0.5f * component.fieldOfView * 0.0174532924f);
				float x = num2 / this.fStops;
				blurCoe = new Vector4(0f, 0f, 1f, 1f);
				blurParams = new Vector4(x, num2, num, w);
			}
			else
			{
				float num3 = this.nearPlane * this.nearPlane * this.nearPlane * this.nearPlane;
				float num4 = this.farPlane * this.farPlane * this.farPlane * this.farPlane;
				float num5 = this.focusRange * this.focusRange * this.focusRange * this.focusRange;
				float num6 = num5;
				if (num <= num3)
				{
					num = num3 + 1E-07f;
				}
				if (num >= num4)
				{
					num = num4 - 1E-07f;
				}
				if (num - num5 <= num3)
				{
					num5 = num - num3 - 1E-07f;
				}
				if (num + num6 >= num4)
				{
					num6 = num4 - num - 1E-07f;
				}
				float num7 = 1f / (num3 - num + num5);
				float num8 = 1f / (num4 - num - num6);
				float num9 = 1f - num7 * num3;
				float num10 = 1f - num8 * num4;
				blurParams = new Vector4(-1f * num7, -1f * num9, 1f * num8, 1f * num10);
				blurCoe = new Vector4(0f, 0f, (num10 - num9) / (num7 - num8), 0f);
			}
		}

		// Token: 0x06001CF2 RID: 7410 RVA: 0x000122F1 File Offset: 0x000104F1
		public void ReleaseComputeResources()
		{
			if (this.m_ComputeBufferDrawArgs != null)
			{
				this.m_ComputeBufferDrawArgs.Release();
			}
			this.m_ComputeBufferDrawArgs = null;
			if (this.m_ComputeBufferPoints != null)
			{
				this.m_ComputeBufferPoints.Release();
			}
			this.m_ComputeBufferPoints = null;
		}

		// Token: 0x06001CF3 RID: 7411 RVA: 0x00062B6C File Offset: 0x00060D6C
		public void ComputeBlurDirections(bool force)
		{
			if (!force && Math.Abs(this.m_LastApertureOrientation - this.apertureOrientation) < 1.401298E-45f)
			{
				return;
			}
			this.m_LastApertureOrientation = this.apertureOrientation;
			float num = this.apertureOrientation * 0.0174532924f;
			float cosinus = Mathf.Cos(num);
			float sinus = Mathf.Sin(num);
			this.m_OctogonalBokehDirection1 = new Vector4(0.5f, 0f, 0f, 0f);
			this.m_OctogonalBokehDirection2 = new Vector4(0f, 0.5f, 1f, 0f);
			this.m_OctogonalBokehDirection3 = new Vector4(-0.353553f, 0.353553f, 1f, 0f);
			this.m_OctogonalBokehDirection4 = new Vector4(0.353553f, 0.353553f, 1f, 0f);
			this.m_HexagonalBokehDirection1 = new Vector4(0.5f, 0f, 0f, 0f);
			this.m_HexagonalBokehDirection2 = new Vector4(0.25f, 0.433013f, 1f, 0f);
			this.m_HexagonalBokehDirection3 = new Vector4(0.25f, -0.433013f, 1f, 0f);
			if (num > 1.401298E-45f)
			{
				DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection1, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection2, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection3, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection4, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection1, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection2, cosinus, sinus);
				DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection3, cosinus, sinus);
			}
		}

		// Token: 0x1700020F RID: 527
		// (get) Token: 0x06001CF4 RID: 7412 RVA: 0x0001232D File Offset: 0x0001052D
		public bool shouldPerformBokeh
		{
			get
			{
				return ImageEffectHelper.supportsDX11 && this.useBokehTexture && this.textureBokehMaterial;
			}
		}

		// Token: 0x06001CF5 RID: 7413 RVA: 0x00062D04 File Offset: 0x00060F04
		public static void Rotate2D(ref Vector4 direction, float cosinus, float sinus)
		{
			Vector4 vector = direction;
			direction.x = vector.x * cosinus - vector.y * sinus;
			direction.y = vector.x * sinus + vector.y * cosinus;
		}

		// Token: 0x06001CF6 RID: 7414 RVA: 0x00062D4C File Offset: 0x00060F4C
		public static void SwapRenderTexture(ref RenderTexture src, ref RenderTexture dst)
		{
			RenderTexture renderTexture = dst;
			dst = src;
			src = renderTexture;
		}

		// Token: 0x06001CF7 RID: 7415 RVA: 0x00062D64 File Offset: 0x00060F64
		public static void GetDirectionalBlurPassesFromRadius(RenderTexture blurredFgCoc, float maxRadius, out int blurPass, out int blurAndMergePass)
		{
			if (blurredFgCoc == null)
			{
				if (maxRadius > 10f)
				{
					blurPass = 25;
					blurAndMergePass = 27;
				}
				else if (maxRadius > 5f)
				{
					blurPass = 21;
					blurAndMergePass = 23;
				}
				else
				{
					blurPass = 17;
					blurAndMergePass = 19;
				}
			}
			else if (maxRadius > 10f)
			{
				blurPass = 26;
				blurAndMergePass = 28;
			}
			else if (maxRadius > 5f)
			{
				blurPass = 22;
				blurAndMergePass = 24;
			}
			else
			{
				blurPass = 18;
				blurAndMergePass = 20;
			}
		}

		// Token: 0x04001509 RID: 5385
		public const float kMaxBlur = 35f;

		// Token: 0x0400150A RID: 5386
		[Tooltip("Allow to view where the blur will be applied. Yellow for near blur, Blue for far blur.")]
		public bool visualizeBluriness;

		// Token: 0x0400150B RID: 5387
		[Tooltip("When enabled quality settings can be hand picked, rather than being driven by the quality slider.")]
		public bool customizeQualitySettings;

		// Token: 0x0400150C RID: 5388
		public bool prefilterBlur = true;

		// Token: 0x0400150D RID: 5389
		public DepthOfField.FilterQuality medianFilter = DepthOfField.FilterQuality.High;

		// Token: 0x0400150E RID: 5390
		public bool dilateNearBlur = true;

		// Token: 0x0400150F RID: 5391
		public bool highQualityUpsampling = true;

		// Token: 0x04001510 RID: 5392
		[DepthOfField.GradientRangeAttribute(0f, 100f)]
		[Tooltip("Color represent relative performance. From green (faster) to yellow (slower).")]
		public float quality = 100f;

		// Token: 0x04001511 RID: 5393
		[Range(0f, 1f)]
		public float focusPlane = 0.225f;

		// Token: 0x04001512 RID: 5394
		[Range(0f, 1f)]
		public float focusRange = 0.9f;

		// Token: 0x04001513 RID: 5395
		[Range(0f, 1f)]
		public float nearPlane;

		// Token: 0x04001514 RID: 5396
		[Range(0f, 35f)]
		public float nearRadius = 20f;

		// Token: 0x04001515 RID: 5397
		[Range(0f, 1f)]
		public float farPlane = 1f;

		// Token: 0x04001516 RID: 5398
		[Range(0f, 35f)]
		public float farRadius = 20f;

		// Token: 0x04001517 RID: 5399
		[Range(0f, 35f)]
		public float radius = 20f;

		// Token: 0x04001518 RID: 5400
		[Range(0.5f, 4f)]
		public float boostPoint = 0.75f;

		// Token: 0x04001519 RID: 5401
		[Range(0f, 1f)]
		public float nearBoostAmount;

		// Token: 0x0400151A RID: 5402
		[Range(0f, 1f)]
		public float farBoostAmount;

		// Token: 0x0400151B RID: 5403
		[Range(0f, 32f)]
		public float fStops = 5f;

		// Token: 0x0400151C RID: 5404
		[Range(0.01f, 5f)]
		public float textureBokehScale = 1f;

		// Token: 0x0400151D RID: 5405
		[Range(0.01f, 100f)]
		public float textureBokehIntensity = 50f;

		// Token: 0x0400151E RID: 5406
		[Range(0.01f, 50f)]
		public float textureBokehThreshold = 2f;

		// Token: 0x0400151F RID: 5407
		[Range(0.01f, 1f)]
		public float textureBokehSpawnHeuristic = 0.15f;

		// Token: 0x04001520 RID: 5408
		public Transform focusTransform;

		// Token: 0x04001521 RID: 5409
		public Texture2D bokehTexture;

		// Token: 0x04001522 RID: 5410
		public DepthOfField.ApertureShape apertureShape;

		// Token: 0x04001523 RID: 5411
		[Range(0f, 179f)]
		public float apertureOrientation;

		// Token: 0x04001524 RID: 5412
		[Tooltip("Use with care Bokeh texture are only available on shader model 5, and performance scale with the number of bokehs.")]
		public bool useBokehTexture;

		// Token: 0x04001525 RID: 5413
		public DepthOfField.UIMode uiMode;

		// Token: 0x04001526 RID: 5414
		public Shader filmicDepthOfFieldShader;

		// Token: 0x04001527 RID: 5415
		public Shader medianFilterShader;

		// Token: 0x04001528 RID: 5416
		public Shader textureBokehShader;

		// Token: 0x04001529 RID: 5417
		[NonSerialized]
		public RenderTexureUtility m_RTU = new RenderTexureUtility();

		// Token: 0x0400152A RID: 5418
		public ComputeBuffer m_ComputeBufferDrawArgs;

		// Token: 0x0400152B RID: 5419
		public ComputeBuffer m_ComputeBufferPoints;

		// Token: 0x0400152C RID: 5420
		public Material m_FilmicDepthOfFieldMaterial;

		// Token: 0x0400152D RID: 5421
		public Material m_MedianFilterMaterial;

		// Token: 0x0400152E RID: 5422
		public Material m_TextureBokehMaterial;

		// Token: 0x0400152F RID: 5423
		public float m_LastApertureOrientation;

		// Token: 0x04001530 RID: 5424
		public Vector4 m_OctogonalBokehDirection1;

		// Token: 0x04001531 RID: 5425
		public Vector4 m_OctogonalBokehDirection2;

		// Token: 0x04001532 RID: 5426
		public Vector4 m_OctogonalBokehDirection3;

		// Token: 0x04001533 RID: 5427
		public Vector4 m_OctogonalBokehDirection4;

		// Token: 0x04001534 RID: 5428
		public Vector4 m_HexagonalBokehDirection1;

		// Token: 0x04001535 RID: 5429
		public Vector4 m_HexagonalBokehDirection2;

		// Token: 0x04001536 RID: 5430
		public Vector4 m_HexagonalBokehDirection3;

		// Token: 0x0200059C RID: 1436
		[AttributeUsage(AttributeTargets.Field)]
		public sealed class GradientRangeAttribute : PropertyAttribute
		{
			// Token: 0x06001CF8 RID: 7416 RVA: 0x00012352 File Offset: 0x00010552
			public GradientRangeAttribute(float min, float max)
			{
				this.min = min;
				this.max = max;
			}

			// Token: 0x04001537 RID: 5431
			public readonly float max;

			// Token: 0x04001538 RID: 5432
			public readonly float min;
		}

		// Token: 0x0200059D RID: 1437
		public enum Passes
		{
			// Token: 0x0400153A RID: 5434
			BlurAlphaWeighted,
			// Token: 0x0400153B RID: 5435
			BoxBlur,
			// Token: 0x0400153C RID: 5436
			DilateFgCocFromColor,
			// Token: 0x0400153D RID: 5437
			DilateFgCoc,
			// Token: 0x0400153E RID: 5438
			CaptureCoc,
			// Token: 0x0400153F RID: 5439
			CaptureCocExplicit,
			// Token: 0x04001540 RID: 5440
			VisualizeCoc,
			// Token: 0x04001541 RID: 5441
			VisualizeCocExplicit,
			// Token: 0x04001542 RID: 5442
			CocPrefilter,
			// Token: 0x04001543 RID: 5443
			CircleBlur,
			// Token: 0x04001544 RID: 5444
			CircleBlurWithDilatedFg,
			// Token: 0x04001545 RID: 5445
			CircleBlurLowQuality,
			// Token: 0x04001546 RID: 5446
			CircleBlowLowQualityWithDilatedFg,
			// Token: 0x04001547 RID: 5447
			Merge,
			// Token: 0x04001548 RID: 5448
			MergeExplicit,
			// Token: 0x04001549 RID: 5449
			MergeBicubic,
			// Token: 0x0400154A RID: 5450
			MergeExplicitBicubic,
			// Token: 0x0400154B RID: 5451
			ShapeLowQuality,
			// Token: 0x0400154C RID: 5452
			ShapeLowQualityDilateFg,
			// Token: 0x0400154D RID: 5453
			ShapeLowQualityMerge,
			// Token: 0x0400154E RID: 5454
			ShapeLowQualityMergeDilateFg,
			// Token: 0x0400154F RID: 5455
			ShapeMediumQuality,
			// Token: 0x04001550 RID: 5456
			ShapeMediumQualityDilateFg,
			// Token: 0x04001551 RID: 5457
			ShapeMediumQualityMerge,
			// Token: 0x04001552 RID: 5458
			ShapeMediumQualityMergeDilateFg,
			// Token: 0x04001553 RID: 5459
			ShapeHighQuality,
			// Token: 0x04001554 RID: 5460
			ShapeHighQualityDilateFg,
			// Token: 0x04001555 RID: 5461
			ShapeHighQualityMerge,
			// Token: 0x04001556 RID: 5462
			ShapeHighQualityMergeDilateFg
		}

		// Token: 0x0200059E RID: 1438
		public enum MedianPasses
		{
			// Token: 0x04001558 RID: 5464
			Median3,
			// Token: 0x04001559 RID: 5465
			Median3X3
		}

		// Token: 0x0200059F RID: 1439
		public enum BokehTexturesPasses
		{
			// Token: 0x0400155B RID: 5467
			Apply,
			// Token: 0x0400155C RID: 5468
			Collect
		}

		// Token: 0x020005A0 RID: 1440
		public enum UIMode
		{
			// Token: 0x0400155E RID: 5470
			Basic,
			// Token: 0x0400155F RID: 5471
			Advanced,
			// Token: 0x04001560 RID: 5472
			Explicit
		}

		// Token: 0x020005A1 RID: 1441
		public enum ApertureShape
		{
			// Token: 0x04001562 RID: 5474
			Circular,
			// Token: 0x04001563 RID: 5475
			Hexagonal,
			// Token: 0x04001564 RID: 5476
			Octogonal
		}

		// Token: 0x020005A2 RID: 1442
		public enum FilterQuality
		{
			// Token: 0x04001566 RID: 5478
			None,
			// Token: 0x04001567 RID: 5479
			Normal,
			// Token: 0x04001568 RID: 5480
			High
		}
	}
}
